<template>
  <div>
    <myHeader :title="title" />
    <div id="videoCom"></div>
  </div>
</template>

<script>
import myHeader from "@/components/Header";
export default {
  components: {
    myHeader
  },
  data() {
    return {
      title: {
        name: "视频"
      }
    };
  },
  created() {
    let video_id = this.$route.query.video_id;
    let id = this.$route.query.id;
    this.title.name = this.$route.query.title || '视频'
    this.$http
      .get(`/api/app/getPlayToken/video_id=${video_id}/course_id=${id}`)
      .then(res => {
        // eslint-disable-next-line
        let player = new bjcPlayer("#videoCom", {
          token: res.token,
          // media: 'audio',
          // privateDomainPrefix: "https://b62327424.at.baijiayun.com", // 专属域名前缀 --网校
          definition: "hign" // hign 高清 low 低清
        });
        player.play(res.video_id);
      });
  }
};
</script>

<style lang="scss" scoped>
#videoCom {
  width: 100%;
  height: 500px;
}
</style>

